package cn.xopencode.recordservice.manager.sf6machine;

import cn.xopencode.common.framework.vo.CommonResult;
import cn.xopencode.common.framework.vo.PageResult;
import cn.xopencode.recordservice.convert.robotroom.AdminRecordConvert;
import cn.xopencode.recordservice.convert.sf6machine.Sf6MachineRecordConvert;
import cn.xopencode.recordservice.rpc.robotroom.dto.AdminRecordPageDTO;
import cn.xopencode.recordservice.rpc.sf6machine.dto.*;
import cn.xopencode.recordservice.rpc.sf6machine.vo.*;
import cn.xopencode.recordservice.service.sf6machine.Sf6MachineRecordService;
import cn.xopencode.recordservice.service.sf6machine.bo.Sf6MachineRecordBO;
import cn.xopencode.recordservice.service.sf6machine.bo.Sf6MachineRecordNextCreateBO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class Sf6MachineRecordManager {

    @Autowired
    private Sf6MachineRecordService sf6MachineRecordService;

    public PageResult<Sf6MachineRecordPageVO> pageSf6MachineRecord(Sf6MachineRecordDTO pageDTO){
        return sf6MachineRecordService.pageSf6MachineRecord(Sf6MachineRecordConvert.INSTANCE.convert(pageDTO));
    }

    public Sf6MachineRecordCreateVO createSf6MachineRecord(Sf6MachineRecordCreateDTO createDTO){
        String recordCode = sf6MachineRecordService.createSf6MachineRecord(Sf6MachineRecordConvert.INSTANCE.convert(createDTO));
        Sf6MachineRecordCreateVO createVO = new Sf6MachineRecordCreateVO();
        createVO.setRecordCode(recordCode);
        return createVO;
    }

    public Integer createSf6MachineRecordNextLine(Sf6MachineRecordNextCreateDTO nextCreateDTO){
        Sf6MachineRecordNextCreateBO nextCreateBO = Sf6MachineRecordConvert.INSTANCE.convert(nextCreateDTO);
        return sf6MachineRecordService.createSf6MachineRecordNextLine(nextCreateBO);
    }

    public Sf6MachineRecordVO getSf6MachineRecordById(String recordId){
        return sf6MachineRecordService.getSf6MachineRecordById(recordId);
    }

    public Sf6MachineRecordNextVO getSf6MachineRecordNextById(String recordCode, Integer recordSeq){
        return sf6MachineRecordService.getSf6MachineRecordNextById(recordCode, recordSeq);
    }

    public Integer updateSf6MachineRecord(Sf6MachineRecordUpdateDTO updateDTO){
        Sf6MachineRecordBO recordBO = Sf6MachineRecordConvert.INSTANCE.convert(updateDTO);
        return sf6MachineRecordService.updateSf6MachineRecord(recordBO);
    }

    public Integer updateSf6MachineRecordNextLine(Sf6MachineRecordNextUpdateDTO nextUpdateDTO){
        Sf6MachineRecordNextCreateBO nextCreateBO = Sf6MachineRecordConvert.INSTANCE.convert(nextUpdateDTO);
        return sf6MachineRecordService.updateSf6MachineRecordNextLine(nextCreateBO);
    }

    public Integer dealSf6MachineRecordLineException(String recordDetailId){
        return sf6MachineRecordService.dealSf6MachineRecordLineException(recordDetailId);
    }

    public PageResult<Sf6MachineRecordAdminPageVO> getAdminPageSf6MachineRecordLine(AdminRecordPageDTO pageDTO){
        return sf6MachineRecordService.getAdminPageSf6MachineRecordLine(AdminRecordConvert.INSTANCE.convert(pageDTO));
    }
}
